﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ALinq.BBS.DataAccess;

namespace ALinq.BBS.Controllers
{
    partial class HomeController
    {
        public ActionResult PostFavor(int pageIndex)
        {
            var userName = base.User.Identity.Name;
            if (string.IsNullOrEmpty(userName))
            {
                return Redirect(this.CreateLoginPageUrl(Request.RawUrl));
            }

            var user = new Users().SingleOrDefault(o => o.Name == userName);
            if (user == null)
            {
                //TODO:
            }

            return View(user.FavorPosts.GetList(pageIndex));
        }
    }
}